package com.study.d019fxml.userstructargs.map;

import java.net.URL;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;

import java.util.ArrayList;

import com.study.d019fxml.userstructargs.Person;

/** 通过Map的形式获取自定义构造方法中fxml中的配置值
*@description
*@author xtayhame
*date 2020年3月16日
*version
*since v1.0
*/
public class PersonFxmlMapMain extends Application{
	public static void main(String[] args) {
		launch(args);
	}

	@Override
	public void start(Stage stage) throws Exception {
		/*	URL url=FXMLLoader.getDefaultClassLoader().getResource("com/study/d019fxml/xmls/Person.fxml");
		Person p=(Person)FXMLLoader.load(url);
		p.setName("A");
		System.out.println(p.getName());
		*/


		/*ArrayList<Person> list=(ArrayList<Person>)FXMLLoader.load(url);
		for(Person p:list){
			System.out.println(p);
		}
*/

		FXMLLoader fxmlLoader = new FXMLLoader();
		fxmlLoader.setLocation(fxmlLoader.getClassLoader().getResource("com/study/d019fxml/xmls/Person.fxml"));
		fxmlLoader.setBuilderFactory(new PersonFactoryBuildMap());
		Person p=(Person)fxmlLoader.load();
		System.out.println(p);

	}
}
